﻿<%@ page title="" language="C#" masterpagefile="~/master/amc_app.master" autoeventwireup="true" inherits="pages_customerdetails, App_Web_pzmkbaed" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="../App_Themes/main/addcustomer.css" rel="stylesheet" type="text/css" />
<link href="../App_Themes/main/PredSrhChgLoc.css" rel="stylesheet" type="text/css" />
    <script src="../_scripts/app/addcustomer.js" type="text/javascript"></script>
    <script src="../_scripts/app/manageCustomer.js" type="text/javascript"></script>
    <script src="../_scripts/app/predictiveSrchProduct.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
    $('.placeholderMenuItem_Clicked').removeClass('placeholderMenuItem_Clicked');
    $('#menuNCustomer').attr('class', 'placeholderMenuItem_Clicked');
});
function fnEditCustomer(obj) {
    var cusid = $(obj).attr('cusid');
    window.location.href = "edit/editCustomerData.aspx?c=" + cusid;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="addCustomerContentContainer" style="width:100%;">
<div style="float:left;margin-left: 15px;margin-top: 30px;">
<asp:Repeater ID="reptrCustomerByID" runat="server">
<ItemTemplate>
    <table cellpadding="5" cellspacing="5">
        <tr>
            <td>
                Customer ID
            </td>
            <td>
                :
            </td>
            <td>
                <asp:Label ID="lblCusID" runat="server" Text='<%# Eval("cus_id") %>' 
                    Font-Bold="True"></asp:Label>
            </td>
            <td>
                <div cusid='<%# Eval("cus_guid") %>' class="editRow"  style="float: left;margin-top: 5px;" onclick="fnEditCustomer(this);"></div>
            </td>
        </tr>
        <tr>
            <td>
                Customer Name
            </td>
            <td>
                :
            </td>
            <td>
                <asp:Label ID="lblCusName" runat="server" Text='<%# Eval("customerName") %>'
                    Font-Bold="True"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                Address
            </td>
            <td>
                :
            </td>
            <td>
                <asp:Label ID="lblCusAddress1" runat="server" Text='<%# Eval("cus_Address1") %>'></asp:Label>&nbsp;<br />
                <asp:Label ID="lblCusAddress2" runat="server" Text='<%# Eval("landmark") %>'></asp:Label>&nbsp;<br />
                <asp:Label ID="lblCusCity" runat="server" Text='<%# Eval("cus_City") %>'></asp:Label>&nbsp;,&nbsp;<asp:Label ID="Label1" runat="server" Text='<%# Eval("cus_State") %>'></asp:Label><br />
                PIN - <asp:Label ID="Label2" runat="server" Text='<%# Eval("cus_Postcode") %>'></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                Email ID
            </td>
            <td>
                :
            </td>
            <td>
                <asp:Label ID="Label3" runat="server" Text='<%# Eval("cus_Email") %>'></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                Mobile
            </td>
            <td>
                :
            </td>
            <td>
                <asp:Label ID="Label4" runat="server" Text='<%# Eval("cus_Mobile") %>'
                    Font-Bold="True"></asp:Label>
            </td>
        </tr>
    </table>
    </ItemTemplate>
    </asp:Repeater>
</div>
<div>
<div class="customerGridContainer">
        <div class="pendingCaseGridContainer" style="margin-left:10px;">
            <div class="pendingCaseGridContainerDiv">
                <div class="pendingCaseGridHeader" style="width:980px;">
                    <span class="dashboardAlertText">Products under AMC</span>
                </div>
                <div class="pendingCaseGridTblHeader" style="width: 1000px;">
                    <span class="pendingCaseGridTblText" style="width: 20px;"></span>
                    <span class="pendingCaseGridTblText" style="width: 270px;">Product</span>
                    <span class="pendingCaseGridTblText">Bill No</span>
                    <span class="pendingCaseGridTblText">AMC Invoice</span>
                    <span class="pendingCaseGridTblText" style="width: 90px;">Valid From</span>
                    <span class="pendingCaseGridTblText">Expire On</span>
                </div>
                <div id="allCustomerGrid" class="pendingCaseRepeaterDiv">
                
                </div>
            </div>
        </div>
</div>
<div class="customerGridContainer">
        <div class="pendingCaseGridContainer" style="margin-left:10px;">
            <div class="pendingCaseGridContainerDiv">
                <div class="pendingCaseGridHeader" style="width:980px;">
                    <span class="dashboardAlertText">Customer Complaints</span>
                </div>
                <div class="pendingCaseGridTblHeader" style="width: 1000px;">
                    <span class="pendingCaseGridTblText" style="width: 100px;">Complaint ID</span>
                    <span class="pendingCaseGridTblText" style="width: 300px;">Description</span>
                    <span class="pendingCaseGridTblText" style="width: 200px;">Product</span>
                    <span class="pendingCaseGridTblText" style="width: 150px;">Assignee</span>
                    <span class="pendingCaseGridTblText" style="width: 100px;">Status</span>
                    <span class="pendingCaseGridTblText" style="width: 50px;"></span>
                    <span class="pendingCaseGridTblText" style="width: 50px;"></span>
                </div>
                <div id="gridCustomerComplaints" class="pendingCaseRepeaterDiv">
                
                </div>
            </div>
        </div>
</div>

        <div style="float:left;margin-top:40px;margin-right:10px;margin-bottom:20px;">
            <div id="cusDataBack" class="adminGrayButton" onclick="fnCusDetailsBackClick();">Back</div>
        </div>
        <div style="float:right; margin-top:40px;margin-right:10px;margin-bottom:20px;">
                <div class="adminGrayButton" onclick="fnAddNewProduct();">Add New Product</div>
                <div class="adminGrayButton" onclick="fnLogComplaint();">Log Complaint</div>
                <div class="adminGrayButton" onclick="suspendCustomer();">Suspend AMC</div>
                <div class="adminGrayButton" onclick="fnDeleteCustomer();">Delete Customer</div>
                <div id="saveCustomerData" class="adminColorButton" onclick="fnRenewAMC();">Renew AMC</div>
        </div>
</div>
</div>
<div id="popComplaintWizzard" style="display:none; width:800px; height:550px;">

</div>
<div id="divAddNewProductWizzard" style="display:none; width:800px; height:550px;">
<div id="SalesAddForm">
<div class="addCustomerFormContainer">
        <div class="addCustomerFormRow">
            <span class="addCustomerFormTextWizzard"><span style="color:Red;">*</span>Sale Bill No.</span>
            <div class="addCustomerFormInputDiv"><input id="txtSaleBill" type="text" class="addCustomerFormInput" maxlength="50" />
            <div id="valBillNo" class="validationAlert"></div>
            </div>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormTextWizzard"><span style="color:Red;">*</span>Bill Date</span>
            <div class="addCustomerFormInputDiv"><input id="txtBillDate" type="text" class="addCustomerFormInput" />
            <div id="valBillDate" class="validationAlert"></div>
            </div>
            <span class="addCustomerFormTextWizzard">Dealer/Outlet</span>
            <div class="addCustomerFormInputDiv"><input id="txtDealer" type="text" class="addCustomerFormInput" maxlength="200" /></div>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormTextWizzard">Product type</span>
            <div class="addCustomerFormInputDiv">
            <asp:DropDownList ID="ddlProdCate" runat="server" CssClass="addCustomerFormInput" onchange="fnDisableTxtboxes(this);"  DataTextField="brandCate" DataValueField="ID" AppendDataBoundItems="true">
                    <asp:ListItem>--Select Product Type--</asp:ListItem>
                </asp:DropDownList>
            <%--<select id="ddlProdCate" class="addCustomerFormInput" onchange="fnDisableTxtboxes(this);">
                            <option value="0">--Select product type--</option>
                            <option value="1">Air Conditioner</option>
                            <option value="2">Battery</option>
                            <option value="3">Freezer</option>
                            <option value="4">Inverters / UPS</option>
                            <option value="5">Water cooler</option>
                            <option value="6">Water dispenser</option>
                            <option value="7">Water heater</option>
                        </select>--%>
            
            </div>
            <span class="addCustomerFormTextWizzard">Product</span>
            <div id="divContainerPredictive" class="addCustomerFormInputDiv" style="position:relative;">
                <input id="txtProductName" type="text" class="addCustomerFormInput" style="font-size: 9px;padding: 8px;width: 213px;" onkeyup="javascript:fnPredictiveSearchLoadProductName(event, this, MainSearch_LocationRefresh,true);return submitButton(event,$('divGobtn'));" />
            </div>
        </div>
        <div class="addCustomerFormRow">
<%--            <span class="addCustomerFormTextWizzard">Model Name</span>
            <div class="addCustomerFormInputDiv">
                <input id="txtModalName" type="text" class="addCustomerFormInput" />
                <%--<asp:DropDownList ID="ddlModalName" CssClass="addCustomerFormInput" runat="server" DataTextField="nModal" DataValueField="id">
                </asp:DropDownList>
            </div>--%>
            <span class="addCustomerFormTextWizzard">Model No.</span>
            <div class="addCustomerFormInputDiv"><input id="txtModalNo" type="text" class="addCustomerFormInput" />
            </div>
            <span class="addCustomerFormTextWizzard">Compressor S.no</span>
            <div class="addCustomerFormInputDiv"><input id="txtCompressorNo" type="text" class="addCustomerFormInput" disabled="disabled" style="background-color:#f2f2f2;" />
            </div>
        </div>
        <div class="addCustomerFormRow">
            
            <span class="addCustomerFormTextWizzard">Indoor S.no</span>
            <div class="addCustomerFormInputDiv"><input id="txtIndoorNo" type="text" class="addCustomerFormInput" disabled="disabled" style="background-color:#f2f2f2;" />
            </div>
            <span class="addCustomerFormTextWizzard">Outdoor S.no</span>
            <div class="addCustomerFormInputDiv"><input id="txtOutdoorNo" type="text" class="addCustomerFormInput" disabled="disabled" style="background-color:#f2f2f2;" />
            </div>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormTextWizzard">Comments</span>
            <div class="addCustomerFormInputDiv" style="height:200px;">
                <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" CssClass="addCustomerFormInput" style="width: 560px; height: 155px;"></asp:TextBox>
            </div>
        </div>
        </div>
        <div class="addCustomerFormButtonContainer">
        <div id="Div1" class="adminColorButton" style="float:right;" onclick="saveSaleWizard();">Save & Continue</div>
        <div class="adminGrayButton" style="float:right;">Cancel</div>
        </div>
        </div>

        <div id="AmcAddForm" style="display:none;">
            <div class="addCustomerFormContainer">
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText"><span style="color:Red;">*</span>Invoice No.</span>
            <div class="addCustomerFormInputDiv"><input id="txtAmcInvoiceNo" disabled="disabled" type="text" class="addCustomerFormInput" /></div>
            </div>  
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText"><span style="color:Red;">*</span>Invoice Date</span>
            <div class="addCustomerFormInputDiv"><input id="txtInvoiceDt" type="text" class="addCustomerFormInput" disabled="disabled" />
            </div>
        </div>          
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText"><span style="color:Red;">*</span>Warranty From</span>
            <div class="addCustomerFormInputDiv"><input id="txtWarrantyFrom" type="text" class="addCustomerFormInput" />
            </div>
            <%--<span class="addCustomerFormText">Warranty</span>
            <div class="addCustomerFormInputDiv">
            <select id="selWarrantyPeriod" class="addCustomerFormInput" onchange="onChangeWarranty();">
                    <option value="0" selected="selected">Please Select</option>
                    <option value="1">1 Year</option>
                    <option value="2">2 Years</option>
                    <option value="3">3 Years</option>
                    <option value="4">4 Years</option>
                    <option value="5">5 Years</option>
                </select>
            </div>--%>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText">Expiry Date</span>
            <div class="addCustomerFormInputDiv"><input id="expiryDate" type="text" class="addCustomerFormInput"/></div>
            <span id="validityPeriod" class="addCustomerFormText" style="font-weight:600; width:300px;"></span>
        </div> 
        <div class="addCustomerFormRow">
        <span class="addCustomerFormText">Payment Mode</span>
            <div class="addCustomerFormInputDiv">
                <input type="radio" id="rbtnCash" name="paymode" value="Cash" class="formRadioBtn" checked="checked" />
                <label for="rbtnCash" class="formRadioLabel">Cash</label>
                <input type="radio" id="rbtnCheque" name="paymode" value="Cheque" class="formRadioBtn" />
                <label for="rbtnCash" class="formRadioLabel">Cheque</label>
                <input type="radio" id="rbtnOthers" name="paymode" value="Others" class="formRadioBtn" />
                <label for="rbtnCash" class="formRadioLabel">Others</label>
            </div>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText">AMC Rate</span>
            <div class="addCustomerFormInputDiv"><input id="txtAMCRate" type="text" class="addCustomerFormInput" />
            <span style="color: #ABABAB;float: left;font-size: 10px;">Enter the AMC rate for one year</span>
            </div>
        </div>
    </div>
    <div class="addCustomerFormButtonContainer">
        <div class="adminColorButton" style="float:right;" onclick="saveAMCDetailsWizzard();">Save & Preview</div>
        <div class="adminGrayButton" style="float:right;">Cancel</div>
    </div>
        </div>
        <asp:HiddenField ID="hidAMCGuid" runat="server" />
        <asp:HiddenField ID="hidSalesGuid" runat="server" />
    </div>
    
    <script type="text/javascript">
        $(document).ready(function () {
            loaducSales();
            loadComplaints();
            cGSaleID = $('input[type=hidden][id*=hidSalesGuid]').val();
            cGAmcID = $('input[type=hidden][id*=hidAMCGuid]').val();
            $('#txtAmcInvoiceNo').val(genDynmID());
            $('#txtInvoiceDt').datepicker({ dateFormat: "mm/dd/yy" }).datepicker("setDate", new Date());
            $('#txtWarrantyFrom').datepicker({ changeYear: true, changeMonth: true, dateFormat: "mm/dd/yy" }).datepicker("setDate", new Date());
            $('#expiryDate').datepicker({ changeYear: true, changeMonth: true, dateFormat: "mm/dd/yy", onSelect: function () {
                var d1 = new Date($('#txtWarrantyFrom').val()); // January 1st 2010
                var d2 = new Date($('#expiryDate').val()); // February 1st 2010
                var diff = d2 - d1;
                var daysRemaining = diff / 1000 / 60 / 60 / 24;
                $('#validityPeriod').text("Valid for " + daysRemaining + " days");
            }
            });
            disableTextbox();
        });
    $(function () {
        var date = new Date();
        var currentMonth = date.getMonth();
        var currentDate = date.getDate();
        var currentYear = date.getFullYear();
        $('#txtBillDate').datepicker({
            maxDate: new Date(currentYear, currentMonth, currentDate)
        });
    });
    function onChangeWarranty() {
        var warnty = $('#selWarrantyPeriod').val();
        var wardate = $('#txtAMCInvoiceDate').val();
        var d = wardate.split('/');
        var yy = parseInt(d[2]) + parseInt(warnty);
        $('#expiryDate').val(d[0] + "/" + d[1] + "/" + yy);

    }
    </script>
</asp:Content>

